//
//  ReceiverInfoCell.m
//  LoveFreshBeen
//
//  Created by 胡不归是大虾 on 2016/10/15.
//  Copyright © 2016年 魏根. All rights reserved.
//

#import "ReceiverInfoCell.h"
#import <Masonry.h>
#define randomColor [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1]
@interface ReceiverInfoCell( )
@property(nonatomic,weak) UILabel* receiverLable;
@property(nonatomic,weak) UILabel* phoneLable;
@property(nonatomic,weak) UILabel* addressLable;

@property(nonatomic,weak) UILabel* receiverTextLable;
@property(nonatomic,weak) UILabel* phoneTextLable;
@property(nonatomic,weak) UILabel* addressTextLabel;

@property(nonatomic,weak) UIImageView* topLineView;
@property(nonatomic,weak) UIImageView* bottomLineView;










@end
@implementation ReceiverInfoCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpUI];
    }
    return  self;
}
-(void)setUpUI {
    //设置cell辅助视图
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    //设置约束
    [self.topLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.contentView);
        make.height.equalTo(@3);
    }];
    [self.bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self.contentView);
        make.height.equalTo(@3);
    }];
    [self.receiverLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topLineView.mas_bottom).offset(10);
        make.left.equalTo(self.contentView).offset(20);
        make.width.equalTo(@100);
    }];
    [self.addressLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(20);
        make.bottom.equalTo(self.bottomLineView).offset(-10);
        make.width.equalTo(@100);
    }];
    [self.phoneLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(20);
        make.width.equalTo(@100);
    }];
    [self.receiverTextLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.receiverLable.mas_right).offset(20);
        make.right.equalTo(self.contentView).offset(-20);
    }];
    [self.phoneTextLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.receiverTextLable.mas_bottom).offset(10);
        make.left.equalTo(self.phoneLable.mas_right).offset(20);
        make.right.equalTo(self.contentView).offset(-20);
    }];
    [self.addressTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.phoneTextLable.mas_bottom).offset(10);
        make.left.equalTo(self.addressLable.mas_right).offset(20);
        make.right.equalTo(self.contentView).offset(-20);
    }];
}

#pragma mark--懒加载控件
-(UIImageView *)topLineView{
    if (_topLineView == nil) {
        UIImageView* topLineView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"v2_shoprail"]];
        _topLineView = topLineView;
        [self.contentView addSubview:topLineView];
    }
    return  _topLineView;
}
-(UIImageView *)bottomLineView{
    if (_bottomLineView == nil) {
        UIImageView* bottomLineView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"v2_shoprail"]];
        _bottomLineView = bottomLineView;
        [self.contentView addSubview:bottomLineView];
    }
    return  _bottomLineView;
}
-(UILabel *)phoneLable{
    if (_phoneLable == nil) {
        UILabel* phoneLable = [[UILabel alloc] init];
        phoneLable.text = @"电话";
        phoneLable.font = [UIFont systemFontOfSize:15];
        _phoneLable = phoneLable;
        [self.contentView addSubview:phoneLable];
    }
    return _phoneLable;
}
-(UILabel *)receiverLable{
    if (_receiverLable == nil) {
        UILabel* receiverLable = [[UILabel alloc] init];
        receiverLable.text = @"收货人";
        receiverLable.font = [UIFont systemFontOfSize:15];
        _receiverLable = receiverLable;
        
        [self.contentView addSubview:receiverLable];
    }
    return _receiverLable;
}
-(UILabel *)addressLable{
    if (_addressLable == nil) {
        UILabel* addressLable = [[UILabel alloc] init];
        addressLable.text = @"收货地址";
        addressLable.font = [UIFont systemFontOfSize:15];
        _addressLable = addressLable;
        [self.contentView addSubview:addressLable];
    }
    return _addressLable;
}
-(UILabel *)addressTextLabel{
    if (_addressTextLabel == nil) {
        UILabel* addressTextLable = [[UILabel alloc] init];
        _addressTextLabel = addressTextLable;
        addressTextLable.text = @"人民大会堂 9527办公室";
        addressTextLable.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_addressTextLabel];
    }
    return _addressTextLabel;
}
-(UILabel *)receiverTextLable{
    if (_receiverTextLable == nil) {
        UILabel* receiverTextLable = [[UILabel alloc] init];
        _receiverTextLable = receiverTextLable;
        receiverTextLable.text = @"维尼的小熊 先生";
        receiverTextLable.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:receiverTextLable];
    }
    return _receiverTextLable;
}
-(UILabel *)phoneTextLable{
    if (_phoneTextLable == nil) {
        UILabel* phoneTextLable = [[UILabel alloc] init];
        _phoneTextLable = phoneTextLable;
        phoneTextLable.text = @"18833331111";
        phoneTextLable.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:phoneTextLable];
    }
    return _phoneTextLable;
}


@end
